package model

import (
	"manager/model/entity"
)

// VoiceCreateRequest 创建现场数据
type VoiceCreateRequest struct {
	Name string `json:"name"`

	Url string `json:"url"`

	UpdatedAt int64 `json:"updated_at"`
}

// VoiceUpdateRequest 更新现场数据
type VoiceUpdateRequest struct {
	Id int64 `json:"id"`

	Name *string `json:"name"`

	Url *string `json:"url"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt *int64 `json:"updated_at"`
}

// VoiceListRequest 列表现场数据
type VoiceListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	Id int64 `json:"id"`

	Name *string `json:"name"`

	Url *string `json:"url"`

	UpdatedAt *int64 `json:"updated_at"`
}

// VoiceListResponse 列表回包数据
type VoiceListResponse struct {
	Total int          `json:"total"`
	List  []*VoiceInfo `json:"list"`
}

// VoiceInfoRequest 列表现场数据
type VoiceInfoRequest struct {
	Id int64 `json:"id"`

	Name *string `json:"name"`

	Url *string `json:"url"`

	UpdatedAt *int64 `json:"updated_at"`
}

// VoiceInfo 详细数据
type VoiceInfo struct {
	Id int64 `json:"id"`

	Name string `json:"name"`

	Url string `json:"url"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt int64 `json:"updated_at"`
}

// VoiceDeleteRequest 删除现场数据
type VoiceDeleteRequest struct {
	Id int64 `json:"id"`
}

// VoicesEntityToDto entity数据转换
func VoicesEntityToDto(voices []*entity.Voice) []*VoiceInfo {
	out := make([]*VoiceInfo, 0, len(voices))
	for _, c := range voices {
		out = append(out, VoiceEntityToDto(c))
	}
	return out
}

// VoiceEntityToDto entity数据转换
func VoiceEntityToDto(e *entity.Voice) *VoiceInfo {
	return &VoiceInfo{

		Id: e.Id,

		Name: e.Name,

		Url: e.Url,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
